package com.fenqing.leetcode.code.t2000_2100;

import com.fenqing.annotations.Execute;
import com.fenqing.core.Topic;

public class Topic2011 extends Topic {

    @Execute
    public int finalValueAfterOperations(String[] operations) {
        int result = 0;
        for (String operation : operations) {
            char ch = operation.charAt(0);
            char c = operation.charAt(operation.length() - 1);
            if (ch == '+' || c == '+') {
                result++;
            } else {
                result--;
            }
        }
        return result;
    }

    public static void main(String[] args) {
        Topic2011 topic2011 = new Topic2011();
        int run = topic2011.run("[\"--X\",\"X++\",\"X++\"]");
        System.out.println(run);
    }

}
